package top.leyi.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import top.leyi.entity.user.User;

import java.util.List;

public interface AttenMapper {

    @Select("SELECT  u.* from attention a join user u on u.id= a.fans where bigV = #{value}  and is_delete = 0 ")
    public List<User> queryAllFans(int id);

    @Select("SELECT  u.* from attention a join user u on u.id= a.bigV where fans = #{value}  and is_delete = 0 ")
    public List<User> queryAllV(int id);


    @Insert("INSERT into attention(bigv, fans) values (#{vId},#{fansId})")
    public void addAtten(int vId, int fansId);


    @Delete("update attention set is_delete = 1 where bigv = #{vId} and fans = #{fansId} and is_delete = 0 ")
    public void removeAtten(int vId, int fansId);

}
